package com.atguigu.springbootmq.consumer;



import com.atguigu.springbootmq.config.TtlQueueConfig;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


import java.util.Date;

/**
 * 队列 ttl的消费者
 */

@Slf4j
@Component  //装饰器语法而已，
public class DeadLetterQueueConsumer {

    //接受消息
    @RabbitListener(queues="QD")
  //  @RabbitListener(queues = {TtlQueueConfig.DEAD_LETTER_QUEUE})
    public void receiveD(Message message, Channel channel)throws Exception{
        String msg = new String(message.getBody());
        log.info("当前时间：{},收到死信队列信息{}",new Date().toString(),msg);

    }




}
